package org.adorsys.aderp.cash.work.encashment.redirect;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.adorsys.aderp.cash.domain.CashReceipt;
import org.adorsys.aderp.cash.domain.CashRegItem;


public class DataCollection {
	private List<CashRegItem> cashRegItems = new ArrayList<CashRegItem>();
	
	private Map<String, List<CashRegItem>> data = new HashMap<String, List<CashRegItem>>();
	/**
	 * every line of this map, will office of a cash receipt.
	 */
	private Map<String, List<CashRegItemComponent>> cashRegItemCompData = new HashMap<String, List<CashRegItemComponent>>();
	
	public void addData(Collection<CashRegItem> cashRegItems){
		this.cashRegItems.addAll(cashRegItems);
	}
	public void addData(CashRegItem cashRegItem){
		this.cashRegItems.add(cashRegItem);
	}
	public void addData(CashReceipt cashReceipt,CashRegItem cashRegItem){
	}
	public void addData(String key,CashRegItemComponent cashRegItemComponent){
		List<CashRegItemComponent> list = this.cashRegItemCompData.get(key);
		if(list == null){
			list = new ArrayList<CashRegItemComponent>();
		}
		list.add(cashRegItemComponent);
	}
	public void addData(String key, List<CashRegItemComponent> firstVague) {
		if(this.cashRegItemCompData.containsKey(key))
			this.cashRegItemCompData.get(key).addAll(firstVague);
	}
	
	@Override
	public String toString() {
		return this.cashRegItemCompData.toString();
	}
}
